package com.qf.handle;

import com.qf.exception.AirException;
import com.qf.vo.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author ASUS
 * @version V1.0
 * @Project work
 * @Package com.qf.handle
 * @Date 2021/10/9 16:14
 */
@RestControllerAdvice
public class AirExceptionHandler{

    @ExceptionHandler(AirException.class)
    public R handle(AirException ex){
        System.out.println(ex);
        return R.error(ex.getCode(),ex.getMessage());
    }

    @ExceptionHandler(Exception.class)
    public R exception(Exception ex){
        System.out.println(ex);
        return R.error(500,"未知错误");
    }

}
